using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class web_pages_Listby_MasterPage : System.Web.UI.MasterPage
{
    Common _common = null;
    public string _page = "timviec";
    public string _type = "nganhnghe";
    protected void Page_Load(object sender, EventArgs e)
    {
        _common = new Common();
        ContentPlaceHolder_Defualt_top_banner.Controls.Add(new UserControl().LoadControl("~/web/Controls/Ctrl_vl_top_sub_banner.ascx"));
        if (Request.Params["page"] != null && Request.Params["type"] != null)
        {
            _page = Request.Params["page"].ToString();
            _type = Request.Params["type"].ToString();
            if (_page.Trim().Equals("timviec") && _type.Trim().Equals("nganhnghe"))
            {
                LoadGroupByNganhnghe();
                ContentPlaceHolder_Default_Content_Left.Controls.Add(new UserControl().LoadControl("~/web/Controls/ctrl_vl_left_list_vlt_by_nganh.ascx"));
            }
            if (_page.Trim().Equals("timviec") && _type.Trim().Equals("chucdanh"))
            {
                LoadGroupByChucdanh();
                ContentPlaceHolder_Default_Content_Left.Controls.Add(new UserControl().LoadControl("~/web/Controls/ctrl_vl_left_list_vlt_by_nganh.ascx"));
            }
        }
    }
    void LoadGroupByChucdanh()
    {
        rpt_group_by_chucdanh.DataSource = _common.ExeceuteDataset("select A.ma_chuc_danh as MA, A.ten_chuc_danh as TEN, B.total as TOTAL from danhmuc_chuc_danh as A right outer join (select ma_chuc_danh, count(ma_chuc_danh) as total from ViecLamTrong_ho_so_tuyen_dung where kich_hoat = 1 group by ma_chuc_danh) as B on A.ma_chuc_danh = B.ma_chuc_danh");
        rpt_group_by_chucdanh.DataBind();
    }
    void LoadGroupByNganhnghe()
    {
        rpt_group_by_chucdanh.DataSource = _common.ExeceuteDataset("select A.ma_chuyen_mon as MA, A.ten_chuyen_mon as TEN, B.total as TOTAL from DanhMuc_chuyen_mon as A right outer join (select count(A.ma_chuyen_mon) as total, A.ma_chuyen_mon from ViecLamTrong_yeu_cau_chuyen_mon as A where A.kich_hoat = 1 group by A.ma_chuyen_mon) as B on A.ma_chuyen_mon = B.ma_chuyen_mon");
        rpt_group_by_chucdanh.DataBind();
    }
}
